<template>
  <div class="decision">
    <!-- 左边底部底图影像、数据名称切换面板 -->
    <div
      :class="[
        'bottom-tab-box',
        'bottom-tab-box-left',
        isLeftShrink ? 'shrink' : ''
      ]"
      class="bottom-tab-box bottom-tab-box-left"
      :style="
        !isLeftShrink && allLeftDataList.length > 4
          ? 'height: 265px;overflow-y: auto'
          : ''
      "
    >
      <div class="bottom-tab">
        <div class="right-service__wrapper">
          <div @click="mapOpenFun('left')">
            <el-input
              placeholder="底图影像"
              disabled
              style="width: 110px; margin-right: 26px"
              v-show="mapServices.length > 1"
            >
            </el-input>
          </div>

          <!-- 底图影像切换 -->
          <div
            class="right-service"
            v-show="mapServices.length > 1"
          >
            <span
              class="left-right"
              @click="leftShow"
              v-show="
                mapServices.length > 3 && groupIndex !== 1
              "
              >&lt;</span
            >
            <div
              class="service-item"
              :class="
                activeSevice.pkid === item.pkid
                  ? 'active-item'
                  : ''
              "
              v-for="item in showServiceList"
              :key="item.pkid"
              @click="showService(item)"
            >
              <span>{{ item.serviceName }}</span>
            </div>
            <span
              class="left-right"
              @click="rightShow"
              v-show="
                mapServices.length > 3 &&
                groupIndex * 3 < mapServices.length
              "
              >&gt;</span
            >
          </div>
        </div>
        <div
          class="right-service__wrapper"
          v-for="(value, index) in allLeftDataList"
          :key="index"
        >
          <div @click="openFun(index, 'left')">
            <el-input
              :placeholder="value.name"
              disabled
              style="width: 110px; margin-right: 26px"
            >
            </el-input>
          </div>
          <!-- 数据名称切换 -->
          <div class="right-service">
            <span
              class="left-right"
              @click="dataListLeftShow(value)"
              v-show="
                value.dataList.length > 3 &&
                value.currentPage !== 1
              "
              >&lt;</span
            >
            <div
              class="service-item"
              v-for="(item, index2) in value.showDataList"
              :key="item.pkid"
              :class="{
                'active-item':
                  item.pkid ===
                  value.dataList[value.currentIndex].pkid
              }"
              :disable="!item.serviceUrl"
              @click="
                dataClickHandle(item, index, index2, 'left')
              "
            >
              {{ item.serviceName }}
            </div>
            <span
              class="left-right"
              @click="dataListRightShow(value)"
              v-show="
                value.dataList.length > 3 &&
                value.dataList.length >
                  value.currentPage * 3
              "
              >&gt;</span
            >
          </div>
        </div>
      </div>
    </div>

    <!-- 底部底图影像、数据名称切换面板 -->
    <div
      :class="[
        'bottom-tab-box',
        'bottom-tab-box-right',
        isRightShrink ? 'shrink' : ''
      ]"
      :style="
        allRightDataList.length > 4
          ? 'height: 265px;overflow-y: auto'
          : ''
      "
    >
      <div class="bottom-tab">
        <div class="right-service__wrapper">
          <div @click="mapOpenFun('right')">
            <el-input
              placeholder="底图影像"
              disabled
              style="width: 110px; margin-right: 26px"
              v-show="mapCompareServices.length > 1"
            >
            </el-input>
          </div>

          <!-- 底图影像切换 -->
          <div
            class="right-service"
            v-show="mapCompareServices.length > 1"
          >
            <span
              class="left-right"
              @click="leftCompareShow"
              v-show="
                mapCompareServices.length > 3 &&
                groupCompareIndex !== 1
              "
              >&lt;</span
            >
            <div
              class="service-item"
              :class="
                activeCompareSevice.pkid === item.pkid
                  ? 'active-item'
                  : ''
              "
              v-for="item in showCompareServiceList"
              :key="item.pkid"
              @click="showCompareService(item)"
            >
              <span>{{ item.serviceName }}</span>
            </div>
            <span
              class="left-right"
              @click="rightCompareShow"
              v-show="
                mapCompareServices.length > 3 &&
                groupCompareIndex * 3 <
                  mapCompareServices.length
              "
              >&gt;</span
            >
          </div>
        </div>
        <div
          class="right-service__wrapper"
          v-for="(value, index) in allRightDataList"
          :key="index"
        >
          <div @click="openFun(index, 'right')">
            <el-input
              :placeholder="value.name"
              disabled
              style="width: 110px; margin-right: 26px"
            >
            </el-input>
          </div>
          <!-- 数据名称切换 -->
          <div class="right-service">
            <span
              class="left-right"
              @click="dataListLeftShow(value)"
              v-show="
                value.dataList.length > 3 &&
                value.currentPage !== 1
              "
              >&lt;</span
            >
            <div
              class="service-item"
              v-for="(item, index2) in value.showDataList"
              :key="item.pkid"
              :class="{
                'active-item':
                  item.pkid ===
                  value.dataList[value.currentIndex].pkid
              }"
              :disable="!item.serviceUrl"
              @click="
                dataClickHandle(
                  item,
                  index,
                  index2,
                  'right'
                )
              "
            >
              {{ item.serviceName }}
            </div>
            <span
              class="left-right"
              @click="dataListRightShow(value)"
              v-show="
                value.dataList.length > 3 &&
                value.dataList.length >
                  value.currentPage * 3
              "
              >&gt;</span
            >
          </div>
        </div>
      </div>
    </div>

    <!--    <div-->
    <!--      class="right-service left"-->
    <!--      v-show="mapCompareServices.length > 1"-->
    <!--    >-->
    <!--      <span-->
    <!--        class="left-right"-->
    <!--        @click="leftShow"-->
    <!--        v-show="mapServices.length > 3"-->
    <!--        >&lt;</span-->
    <!--      >-->
    <!--      <div-->
    <!--        class="service-item"-->
    <!--        :class="-->
    <!--          activeSevice.pkid === item.pkid-->
    <!--            ? 'active-item'-->
    <!--            : ''-->
    <!--        "-->
    <!--        v-for="item in showServiceList"-->
    <!--        :key="item.pkid"-->
    <!--        @click="showService(item)"-->
    <!--      >-->
    <!--        <span>{{ item.serviceName }}</span>-->
    <!--      </div>-->
    <!--      <span-->
    <!--        class="left-right"-->
    <!--        @click="rightShow"-->
    <!--        v-show="mapServices.length > 3"-->
    <!--        >&gt;</span-->
    <!--      >-->
    <!--    </div>-->

    <!--    <div-->
    <!--      class="right-service right"-->
    <!--      v-show="mapCompareServices.length > 1"-->
    <!--    >-->
    <!--      <span-->
    <!--        class="left-right"-->
    <!--        @click="leftCompareShow"-->
    <!--        v-show="mapCompareServices.length > 3"-->
    <!--      >&lt;</span-->
    <!--      >-->
    <!--      <div-->
    <!--        class="service-item"-->
    <!--        :class="-->
    <!--          activeCompareSevice.pkid === item.pkid-->
    <!--            ? 'active-item'-->
    <!--            : ''-->
    <!--        "-->
    <!--        v-for="item in showCompareServiceList"-->
    <!--        :key="item.pkid"-->
    <!--        @click="showCompareService(item)"-->
    <!--      >-->
    <!--        <span>{{ item.serviceName }}</span>-->
    <!--      </div>-->
    <!--      <span-->
    <!--        class="left-right"-->
    <!--        @click="rightCompareShow"-->
    <!--        v-show="mapCompareServices.length > 3"-->
    <!--      >&gt;</span-->
    <!--      >-->
    <!--    </div>-->

    <div class="left-l" :class="{ 'left-hide': leftHide }">
      <Search v-model="keywordDefault" />
      <el-scrollbar class="scroll">
        <DecisionTree
          :filter="keywordDefault"
          :viewerId="compareLeftViewId"
          treeTypeName=""
        />
      </el-scrollbar>
    </div>
    <div class="left-r">
      <UtoolLeft
        @showData="getShowLeft"
        compare
        :viewerId="compareLeftViewId"
      />
    </div>
    <div
      class="right-l"
      :class="{ 'right-hide': rightHide }"
    >
      <Search v-model="keywordCompare" />
      <el-scrollbar class="scroll">
        <DecisionTree
          :filter="keywordCompare"
          :viewerId="compareViewId"
          treeTypeName=""
        />
      </el-scrollbar>
    </div>
    <div class="right-r">
      <UtoolRight
        @showData="getShowRight"
        compare
        :viewerId="compareViewId"
      />
    </div>
  </div>
</template>

<script>
import Search from '@/components/search'
import UtoolRight from '@/components/utool/index-right'
import UtoolLeft from '@/components/utool/index-left'
import DecisionTree from '@/components/tree/DecisionTree'
import { getAction } from '@/utils/helper'
import { globalBaseMap } from '@/utils/basemap'
import New from '@/utils/new'

export default {
  name: 'decision',
  components: {
    Search,
    UtoolRight,
    UtoolLeft,
    DecisionTree
  },
  data() {
    return {
      oldAllLeftDataList: [],
      oldAllLeftDataIndex: -1,
      isLeftShrink: true,
      allLeftDataList: [],
      oldAllRightDataList: [],
      oldAllRightDataIndex: -1,
      isRightShrink: true,
      allRightDataList: [],
      keywordDefault: '',
      keywordCompare: '',
      leftHide: false,
      rightHide: false,
      mapServices: [],
      activeSevice: {},
      groupIndex: 1,
      showServiceList: [],
      mapCompareServices: [],
      activeCompareSevice: {},
      groupCompareIndex: 1,
      showCompareServiceList: []
    }
  },
  computed: {
    compareLeftViewId() {
      return this.$store.state.layer.compareLeftViewId
    },
    compareViewId() {
      return this.$store.state.layer.compareViewId
    }
  },
  async mounted() {
    this.$bus.$emit('toggleCompare', true)
    this.compareLeftAction = await getAction(
      this.compareLeftViewId
    )
    this.compareAction = await getAction(this.compareViewId)
    this.initCompare()

    New.$on('mapIndex', (data) => {
      if (data.list.length && this.showServiceList.length) {
        this.activeSevice = data.active
        return
      }
      this.mapServices = data.list
      if (this.mapServices.length > 3) {
        this.showServiceList = [...this.mapServices].slice(
          0,
          3
        )
      } else {
        this.showServiceList = [...this.mapServices]
      }
      this.activeSevice = data.active
    })
    New.$on('mapCompareIndex', (data) => {
      if (
        data.list.length &&
        this.showCompareServiceList.length
      ) {
        this.activeCompareSevice = data.active
        return
      }
      this.mapCompareServices = data.list
      if (this.mapCompareServices.length > 3) {
        this.showCompareServiceList = [
          ...this.mapCompareServices
        ].slice(0, 3)
      } else {
        this.showCompareServiceList = [
          ...this.mapCompareServices
        ]
      }
      this.activeCompareSevice = data.active
    })
    New.$on('openTreeDataList', (data) => {
      if (data[1] === this.compareLeftViewId) {
        this.dealDataList(data[0], 'left')
      } else {
        this.dealDataList(data[0], 'right')
      }
    })
    New.$on('closeTreeDataList', (data) => {
      if (data[1] === this.compareLeftViewId) {
        const index = this.allLeftDataList.findIndex(
          (item) => item.pkid === data[0]
        )
        if (index > -1) {
          this.allLeftDataList.splice(index, 1)
        }
      } else {
        const index = this.allRightDataList.findIndex(
          (item) => item.pkid === data[0]
        )
        if (index > -1) {
          this.allRightDataList.splice(index, 1)
        }
      }
    })

    globalBaseMap[this.compareLeftViewId] =
      globalBaseMap[this.compareLeftViewId] ||
      this.compareLeftAction.toolManager.basemapManager
    const leftBaseMapList = await globalBaseMap[
      this.compareLeftViewId
    ].getBasemapList()
    console.log(
      `${this.compareLeftViewId}默认底图`,
      leftBaseMapList
    )
    if (
      globalBaseMap[this.compareLeftViewId]
        .currentBasemapIndex === 0
    ) {
      if (leftBaseMapList.length >= 1) {
        globalBaseMap[this.compareLeftViewId].switchBasemap(
          1
        )
      }
    }

    globalBaseMap[this.compareViewId] =
      globalBaseMap[this.compareViewId] ||
      this.compareAction.toolManager.basemapManager
    const basemapList = await globalBaseMap[
      this.compareViewId
    ].getBasemapList()
    console.log(
      `${this.compareViewId}默认底图:`,
      basemapList
    )
    if (
      globalBaseMap[this.compareViewId]
        .currentBasemapIndex === 0
    ) {
      if (basemapList.length >= 2) {
        globalBaseMap[this.compareViewId].switchBasemap(2)
      }
    }
  },
  beforeDestroy() {
    this.$bus.$emit('toggleCompare', false)
    this.removeCompare()
  },
  methods: {
    dataListRightShow(value) {
      if (value.dataList.length <= value.currentPage * 3) {
        this.$message.error('已经到最后了')
      } else {
        value.currentPage += 1
        if (
          value.dataList.length <=
          value.currentPage * 3
        ) {
          value.showDataList = value.dataList.slice(
            value.currentPage * 3 - 3
          )
        } else {
          value.showDataList = value.dataList.slice(
            value.currentPage * 3 - 3,
            value.currentPage * 3
          )
        }
      }
    },
    dataListLeftShow(value) {
      if (value.currentPage === 1) {
        this.$message.error('已经到最前面了')
      } else {
        value.currentPage -= 1
        value.showDataList = value.dataList.slice(
          value.currentPage * 3 - 3,
          value.currentPage * 3
        )
      }
    },
    dealDataList(data, direction) {
      const layerList = data.dataList
      let showDataList
      if (layerList.length > 3) {
        showDataList = [...layerList].slice(0, 3)
      } else {
        showDataList = [...layerList]
      }
      const tempData = {
        name: data.sourceName,
        dataList: data.dataList,
        showDataList: showDataList,
        currentIndex: 0,
        pkid: data.pkid,
        currentPage: 1
      }
      if (data.dataList.length > 1) {
        if (direction === 'left') {
          this.allLeftDataList.push(tempData)
        } else {
          this.allRightDataList.push(tempData)
        }
      }
    },
    async dataClickHandle(data, index, index2, direction) {
      let arrName = 'allLeftDataList'
      let handleLayerManager
      if (direction !== 'left') {
        arrName = 'allRightDataList'
        const { layerManager } = await getAction(
          this.compareViewId
        )
        handleLayerManager = layerManager
      } else {
        const { layerManager } = await getAction(
          this.compareLeftViewId
        )
        handleLayerManager = layerManager
      }
      const currentIndex =
        (this[arrName][index].currentPage - 1) * 3 + index2
      if (
        this[arrName][index].currentIndex === currentIndex
      ) {
        return
      }
      if (!data.serviceUrl) {
        return
      }
      const currentLayer = handleLayerManager.get(
        this[arrName][index].pkid
      )
      handleLayerManager.del(this[arrName][index].pkid)

      currentLayer.serviceUrl = data.serviceUrl
      currentLayer.signService = data.signService
      currentLayer.pkid = currentLayer.id
      currentLayer.sourceName = currentLayer.title
      currentLayer.currentDataIndex = currentIndex

      handleLayerManager.add(currentLayer)

      this[arrName][index].currentIndex = currentIndex
    },
    leftShow() {
      if (this.groupIndex === 1) {
        this.$message.error('已经到最前面了')
      } else {
        this.groupIndex = this.groupIndex - 1
        this.showServiceList = [...this.mapServices].slice(
          this.groupIndex * 3 - 3,
          this.groupIndex * 3
        )
      }
    },
    rightShow() {
      if (this.mapServices.length <= this.groupIndex * 3) {
        this.$message.error('已经到最后了')
      } else {
        this.groupIndex = this.groupIndex + 1
        if (
          this.mapServices.length <=
          this.groupIndex * 3
        ) {
          this.showServiceList = [
            ...this.mapServices
          ].slice(this.groupIndex * 3 - 3)
        } else {
          this.showServiceList = [
            ...this.mapServices
          ].slice(
            this.groupIndex * 3 - 3,
            this.groupIndex * 3
          )
        }
      }
    },
    mapOpenFun(direction) {
      let arrName = 'allLeftDataList'
      let oldArrName = 'oldAllLeftDataList'
      let shrink = 'isLeftShrink'
      if (direction !== 'left') {
        arrName = 'allRightDataList'
        oldArrName = 'oldAllRightDataList'
        shrink = 'isRightShrink'
      }
      if (this[shrink]) {
        if (this[oldArrName].length) {
          this[arrName] = this[oldArrName]
          this[oldArrName] = []
        }
        this[shrink] = false
      } else {
        if (this[arrName].length) {
          this[oldArrName] = this[arrName]
          this[arrName] = []
        }
        this[shrink] = true
      }
    },
    openFun(index, direction) {
      let arrName = 'allLeftDataList'
      let arrIndex = 'oldAllLeftDataIndex'
      let shrink = 'isLeftShrink'
      if (direction !== 'left') {
        arrName = 'allRightDataList'
        arrIndex = 'oldAllRightDataIndex'
        shrink = 'isRightShrink'
      }
      if (this[shrink]) {
        if (this[arrIndex] > -1) {
          const tempObj =
            this[arrName][this[arrName].length - 1]
          this[arrName].pop()
          this[arrName].splice(this[arrIndex], 0, tempObj)
          this[arrIndex] = -1
        }
        this[shrink] = false
      } else {
        const lastIndex = this[arrName].length - 1
        if (lastIndex !== index) {
          const arr = this[arrName][index]
          this[arrName].splice(index, 1)
          this[arrName].push(arr)
          this[arrIndex] = index
        }
        this[shrink] = true
      }
    },
    showService(data) {
      if (data.pkid !== this.activeSevice.pkid) {
        globalBaseMap[
          this.compareLeftViewId
        ].switchHistoryImagery(data.pkid)
      }
    },
    leftCompareShow() {
      if (this.groupCompareIndex === 1) {
        this.$message.error('已经到最前面了')
      } else {
        this.groupCompareIndex = this.groupCompareIndex - 1
        this.showCompareServiceList = [
          ...this.mapCompareServices
        ].slice(
          this.groupCompareIndex * 3 - 3,
          this.groupCompareIndex * 3
        )
      }
    },
    rightCompareShow() {
      if (
        this.mapCompareServices.length <=
        this.groupCompareIndex * 3
      ) {
        this.$message.error('已经到最后了')
      } else {
        this.groupCompareIndex = this.groupCompareIndex + 1
        if (
          this.mapCompareServices.length <=
          this.groupCompareIndex * 3
        ) {
          this.showCompareServiceList = [
            ...this.mapCompareServices
          ].slice(this.groupCompareIndex * 3 - 3)
        } else {
          this.showCompareServiceList = [
            ...this.mapCompareServices
          ].slice(
            this.groupCompareIndex * 3 - 3,
            this.groupCompareIndex * 3
          )
        }
      }
    },
    showCompareService(data) {
      if (data.pkid !== this.activeCompareSevice.pkid) {
        globalBaseMap[
          this.compareViewId
        ].switchHistoryImagery(data.pkid)
      }
    },

    getShowLeft(data) {
      this.leftHide = data
    },
    getShowRight(data) {
      this.rightHide = data
    },
    removeCompare() {
      this.compareLeftAction.viewer.scene.morphComplete.removeEventListener(
        this.morphComplete
      )
      this.compareAction.viewer.scene.morphComplete.removeEventListener(
        this.compareMorphComplete
      )
      this._removeDefaultCameraChangedListener()
      this._removeCompareCameraChangedListener()
    },
    initCompare() {
      this.compareLeftAction.viewer.scene.morphComplete.addEventListener(
        this.morphComplete
      )
      this.compareAction.viewer.scene.morphComplete.addEventListener(
        this.compareMorphComplete
      )
      this._addDefaultCameraChangedListener()
      this.compareLeftAction.viewer.camera.percentageChanged = 0.01
      this._addCompareCameraChangedListener()
      this.compareAction.viewer.camera.percentageChanged = 0.01
      this._map_extentChangeHandler()
    },
    morphComplete() {
      if (
        this.compareLeftAction.viewer.scene.mode ===
        Cesium.SceneMode.SCENE2D
      ) {
        this.compareAction.viewer.scene.screenSpaceCameraController.enableTilt = false
      } else {
        this.compareAction.viewer.scene.screenSpaceCameraController.enableTilt = true
      }
    },
    compareMorphComplete() {
      if (
        this.compareAction.viewer.scene.mode ===
        Cesium.SceneMode.SCENE2D
      ) {
        this.compareLeftAction.viewer.scene.screenSpaceCameraController.enableTilt = false
      } else {
        this.compareLeftAction.viewer.scene.screenSpaceCameraController.enableTilt = true
      }
    },
    _map_extentChangeHandler() {
      this._removeCompareCameraChangedListener()
      this.updateView(
        this.compareLeftAction.viewer,
        this.compareAction.viewer
      )
      this._addCompareCameraChangedListener()
    },
    _mapEx_extentChangeHandler() {
      this._removeDefaultCameraChangedListener()
      this.updateView(
        this.compareAction.viewer,
        this.compareLeftAction.viewer
      )
      this._addDefaultCameraChangedListener()
    },
    _addDefaultCameraChangedListener() {
      this.compareLeftAction.viewer.camera.changed.addEventListener(
        this._map_extentChangeHandler
      )
    },
    _removeDefaultCameraChangedListener() {
      this.compareLeftAction.viewer.camera.changed.removeEventListener(
        this._map_extentChangeHandler
      )
    },
    _addCompareCameraChangedListener() {
      this.compareAction.viewer.camera.changed.addEventListener(
        this._mapEx_extentChangeHandler
      )
    },
    _removeCompareCameraChangedListener() {
      this.compareAction.viewer.camera.changed.removeEventListener(
        this._mapEx_extentChangeHandler
      )
    },
    // “变化屏”viewerChange变化，将“被更新屏”viewerUpdate同步更新
    updateView(viewerChange, viewerUpdate) {
      const camera = viewerChange.camera
      const point = camera.position
      viewerUpdate.scene.mode === Cesium.SceneMode.SCENE2D
        ? viewerUpdate.camera.setView({
            destination: new Cesium.Cartesian3(
              point.x,
              point.y,
              point.z
            )
          })
        : viewerUpdate.camera.setView({
            destination: new Cesium.Cartesian3(
              point.x,
              point.y,
              point.z
            ),
            orientation: {
              heading: camera.heading,
              pitch: camera.pitch,
              roll: camera.roll
            }
          })
    }
  }
}
</script>

<style lang="scss" scoped>
.decision {
  z-index: 11;
  width: 100%;
  height: 100%;
  position: relative;
  .left {
    &-l {
      position: absolute;
      top: 20px;
      left: 54px;
      height: calc(100vh - 100px);
      width: 263px;
      transition: all 1s;
    }

    &-r {
      position: absolute;
      top: 20px;
      left: 56px;
      transform: translateX(calc(-100% - 10px));
      height: calc(100vh - 100px);
    }

    &-hide {
      //width: 0;
      left: -263px;
    }
  }

  .right {
    &-l {
      position: absolute;
      top: 20px;
      right: 55px;
      // left: 1600px;
      height: calc(100vh - 100px);
      width: 263px;
      transition: all 1s;
    }

    &-r {
      position: absolute;
      top: 20px;
      right: 10px;
      height: calc(100vh - 100px);
    }

    &-hide {
      //width: 0;
      left: 100%;
    }
  }

  .left-l,
  .right-l {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    padding: 14px 8px;
    flex-direction: column;
    border-radius: 4px;
    background-color: rgba(25, 47, 61, 0.9);

    .scroll {
      margin-top: 10px;
      flex: 1;
    }

    ::v-deep {
      // tree 背景色
      .el-tree {
        background-color: transparent;
      }

      // 节点选中颜色
      .el-tree-node:focus > .el-tree-node__content {
        background-color: rgba(255, 255, 255, 0.4);
      }

      // 节点样式
      .el-tree-node__content {
        position: relative;
        padding: 4px 0;
        box-sizing: content-box;
        height: auto;
        // 节点hover
        &:hover {
          background-color: rgba(255, 255, 255, 0.4);
        }

        // checkbox移动到右边
        & > label.el-checkbox {
          position: absolute;
          right: 0;
        }
      }

      .el-tree-node__expand-icon {
        font-size: 10px;
      }

      // checkbox样式
      .el-checkbox__inner {
        width: 12px;
        height: 12px;
        border: 1px solid rgba(255, 255, 255, 0.7);
        background: rgba(255, 255, 255, 0.3);
        z-index: 0;
      }

      // 节点文字
      .el-tree-node__label {
        font-size: 14px;
        font-weight: 800;
        color: #ffffff;
        padding-right: 40px;
        white-space: normal;
        word-wrap: break-word;
        word-break: normal;
        // max-width: 200px;
      }

      // 二级节点文字
      .el-tree-node__children .el-tree-node__label {
        font-weight: 500;
        color: #d2e6f0;
      }

      // scrollbar横向滚动条
      .el-scrollbar__wrap {
        overflow-x: hidden;
      }
    }
  }

  .right {
    width: 48px;
    height: calc(100vh - 60px);
    position: fixed;
    right: 0;
    top: 60px;
    background: rgba(25, 47, 61, 0.85);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
  }

  .bottom-tab-box {
    position: fixed;
    bottom: 38px;
    transform: translateX(-50%);

    &-left {
      left: 30%;
    }

    &-right {
      left: 60%;
    }
  }

  .shrink {
    height: 53px;
    overflow: hidden;
  }

  .bottom-tab-box::-webkit-scrollbar {
    width: 0;
  }

  .bottom-tab {
    display: flex;
    flex-direction: column-reverse;
    justify-content: center;
  }

  .right-service__wrapper {
    //justify-content: center;
    display: flex;
    flex-direction: row;
    position: relative;
    margin-top: 13px;

    ::v-deep {
      .el-input.is-disabled .el-input__inner {
        cursor: default;
      }

      .el-input__inner {
        background-color: transparent;
        background-image: url('~@/assets/img/select@2x.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
        color: white;
        border: none;
        text-align: center;
      }
    }
  }

  .right-service {
    display: flex;
    align-items: center;
    justify-content: space-between;

    &.left {
      left: 25%;
    }

    &.right {
      left: 75%;
    }

    .service-item {
      position: relative;
      width: 138px;
      height: 35px;
      cursor: pointer;
      color: white;
      font-size: 16px;
      font-weight: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      background: url('~@/assets/img/history-imagery-background.png')
        no-repeat;
      background-size: 100% 100%;

      &:not(:last-of-type) {
        margin-right: 9px;
      }

      &.active-item {
        color: #fefefe;
        font-weight: bold;
        background: url('~@/assets/img/history-imagery-active-background.png')
          no-repeat;
        background-size: 100% 100%;
      }
    }

    .left-right {
      text-align: center;
      display: inline-block;
      vertical-align: middle;
      font-size: 20px;
      line-height: 25px;
      cursor: pointer;

      &:first-of-type {
        margin-right: 10px;
      }

      &:last-of-type {
        margin-left: 10px;
      }
    }
  }
}
</style>
